package org.beaconframework.util.xml;

import javax.xml.xpath.XPath;


public class XPathResolverRegistry {
    private VariableResolverRegistry variableResolverRegistry = new VariableResolverRegistry();
    private FunctionResolverRegistry functionResolverRegistry = new FunctionResolverRegistry();
    private NamespaceContextRegistry namespaceContextRegistry = new NamespaceContextRegistry();

    public VariableResolverRegistry getVariableResolverRegistry() {
        return variableResolverRegistry;
    }

    public FunctionResolverRegistry getFunctionResolverRegistry() {
        return functionResolverRegistry;
    }

    public NamespaceContextRegistry getNamespaceContextRegistry() {
        return namespaceContextRegistry;
    }

    public void attach(XPath xp) {
        xp.setNamespaceContext(getNamespaceContextRegistry());
        xp.setXPathFunctionResolver(getFunctionResolverRegistry());
        xp.setXPathVariableResolver(getVariableResolverRegistry());
    }
}
